﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CayleyTree
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }

        private void btn_confirm_Click(object sender, EventArgs e)
        {
            //递归深度
            Form1.N = int.Parse(textBox_n.Text);
            //主干长度
            Form1.Leng = double.Parse(textBox_len.Text);
            //右分支长度比
            Form1.per1 = double.Parse(textBox_per1.Text);
            //左分支长度比
            Form1.per2 = double.Parse(textBox_per2.Text);
            //右分支角度
            Form1.th1 = double.Parse(textBox_th1.Text);
            //左分支角度
            Form1.th2 = double.Parse(textBox_th2.Text);
            //画笔颜色
            switch(comboBox_pen.Text)
            {
                case "Blue":
                    Form1.pen = Pens.Blue;
                    break;
                case "Red":
                    Form1.pen = Pens.Red;
                    break;
                case "Yellow":
                    Form1.pen = Pens.Yellow;
                    break;
                default:
                    Form1.pen = Pens.Blue;
                    break;
            }
            this.Close();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            this.textBox_n.Text = Form1.N.ToString();
            this.textBox_len.Text = Form1.Leng.ToString();
            this.textBox_per1.Text = Form1.per1.ToString();
            this.textBox_per2.Text = Form1.per2.ToString();
            this.textBox_th1.Text = Form1.th1.ToString();
            this.textBox_th2.Text = Form1.th2.ToString();
            this.comboBox_pen.Text = Form1.pen.ToString();

            this.comboBox_pen.Items.AddRange(new string[]{
                "Blue","Red","Yellow"
            });

        }

        private void comboBox_pen_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}
